home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5475 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  40 lines

  1. Newsgroups: comp.lang.c
  2. Path: bath.ac.uk!bsmail!talisker!nathan
  3. From: nathan@pact.srf.ac.uk (Nathan Sidwell)
  4. Subject: Re: Logical exclusive-or
  5. Message-ID: <DMGD6x.73C@uns.bris.ac.uk>
  6. Sender: usenet@uns.bris.ac.uk (Usenet news owner)
  7. Nntp-Posting-Host: talisker.pact.srf.ac.uk
  8. Organization: Inmos
  9. X-Newsreader: TIN [version 1.2 PL2]
  10. References: <4f6lrq$bcr@lastactionhero.rs.itd.umich.edu>
  11. Date: Thu, 8 Feb 1996 10:30:33 GMT
  12.  
  13. David Miller (davidm@umich.edu) wrote:
  14. : Is there a good reason why C doesn't have a logical exclusive-or
  15. : operator?  A look at the precedence hierarchy suggests an obvious
  16. : symbol and precedence for such an operator:
  17.  
  18. : The logical exclusive or would be represented by ^^ and have
  19. : precedence higher than || but lower than && .  If C requires machines
  20. : to be able to implement bitwise XOR, then it would seem reasonable to
  21. : require the logical operator also.
  22.  
  23. Originally C did not have && and || operators, the & and | operators
  24. were used, hence &, | and ^ have lower precedence than the relation
  25. operators. Then a short circuiting operation was required and && and ||
  26. were born. A ^^ was not created because it would not have the short
  27. circuiting property.
  28.  
  29. For more information see http://www.lysator.liu.se/c/
  30. in particular http://www.lysator.liu.se/c/chistory.ps and
  31. http://www.lysator.liu.se/c/dmr-on-or.html#main
  32.  
  33. nathan
  34.  
  35. --
  36. Nathan Sidwell                         Holder of the Xmris home page
  37. Chameleon Architecture Group at SGS-Thomson, formerly Inmos
  38. http://www.pact.srf.ac.uk/~nathan/                  Tel 0117 9707182
  39. nathan@inmos.co.uk or nathan@bristol.st.com or nathan@pact.srf.ac.uk
  40.